home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
basic
/
dialogic.zip
/
EXAMPLE4.BAS
< prev
next >
Wrap
BASIC Source File
|
1990-01-31
|
7KB
|
165 lines
'
'┌───────────────────────────────────────────────────────┐
'│ Written by Jonathan S. Waldman │
'│ (C) 1989, 1990 Jonathan S. Waldman & Dialog Software │
'│ (C) Crescent Software. │
'│ All rights reserved. │
'└───────────────────────────────────────────────────────┘
'============
'DiaLogic
'EXAMPLE4.BAS
'============
'$INCLUDE: 'DIALOGIC.BI' 'include our DiaLogic TYPE definitions
'====================
'Initialize the mouse
'====================
CALL InitMouse(There%) 'see if mouse and driver are there
IF There% THEN 'if yes then
CALL ShowCursor 'show the mouse
CALL TextCursor(0, 4) 'use this to insure mouse is always visible
END IF
'======
'Set-up
'======
CALL HideCursor 'hide the mouse cursor during CLS & PRINTs
WIDTH , 25 'insure we're in 25-line mode
COLOR 15, 1
CLS 'clear the screen
'========================
'REDIM the arrays for now
'========================
'$DYNAMIC 'make all arrays dynamic
MaxDBE = 20 'use for our dimension statements
' 20 dialog box elements will be our max
REDIM SHARED DB(2, MaxDBE) AS DialogType 'REDIM these TYPE arrays
REDIM SHARED LB(0) AS DialogText ' dynamically
'=======================================
'Define some convenient string variables
'=======================================
PRINT
PRINT " This is an example of stacked dialog boxes. Choose <Help> to see this."
PRINT " The <Help> message is displayed on top of the Find dialog box. When"
PRINT " the help is acknowledged, it is removed from the display and the Find"
PRINT " dialog box is restored with all previous selections intact. DiaLogic"
PRINT " automatically preserves underlying information when Level% is > 1."
PRINT " Notice that, unlike Example1, the Find dialog box is NOT regenerated"
PRINT " but rather is re-activated. In other words, in stacked dialog boxes the"
PRINT " underlying dialog box is never removed from the screen."
PRINT
CALL ShowCursor 'show it again
Cancel$ = CHR$(27) 'these are our string assignments, also used
Help$ = CHR$(0) + CHR$(59) ' in the FIND.DB template.
OK$ = CHR$(13)
REDIM SHARED DB(2, MaxDBE) AS DialogType 'REDIM these TYPE arrays
'this example requires 2 Levels in DB()
REDIM SHARED LB(10) AS DialogText
Level% = 1 'set Level% to 1 for the Find dialog box
'$INCLUDE: 'FIND.DB' 'include the Find dialog box template
Action% = 1 'set Action% to 1
'display the dialog box
CALL DiaLogic(DB(), LB(), Action%, Focus%, Ky$)
Action% = 3 'get ready for polling
DO
Focus% = 0 'set the input focus to auto -- 0
CALL DiaLogic(DB(), LB(), Action%, Focus%, Ky$)
IF Count% = 75 OR TIMER - OldTime! > .5 THEN
OldTime! = TIMER
LOCATE 19, 13, 0
COLOR 1, 7
CALL HideCursor
PRINT TIME$;
CALL ShowCursor
Count% = 0
COLOR 15, 1 'restore color to white on blue
END IF
IF Action% = 4 THEN
SELECT CASE Ky$
CASE Help$ '<Help> was selected
Level% = 2 'make Level% = 2 for stacking a Help message
'$INCLUDE: 'FINDH.DB''include Help dialog box template
Action% = 0 'set Action% to 0 so Help is automatically
' removed from the screen
Focus% = 0 'set the input focus to auto -- 0
CALL DiaLogic(DB(), LB(), Action%, Focus%, Ky$)
Action% = 2 'refresh the Find dialog box
CALL DiaLogic(DB(), LB(), Action%, Focus%, Ky$)
Action% = 3 'prepare Find to be re-activated
CASE OK$
'=====================================
'Remove the dialog box from the screen
'=====================================
Action% = 5
CALL DiaLogic(DB(), LB(), Action%, Focus%, Ky$)
'=================================
'Store the Find dialog box results
'=================================
Level% = 1 'insure that the Level is
' correct
Search$ = MID$(DB(Level%, 2).TextString, 1, DB(Level%, 2).NumberOne)
'Search$ holds our search
' string
MatchCase = DB(Level%, 3).Default '-1 if Match Case is checked
WholeWord = DB(Level%, 4).Default '-1 if Whole Words is checked
SearchType = DB(Level%, 5).Default ' 1 for Active Window, 2 for
' Current Module, or 3 for
' All Modules
'==============================
'Print the results to the user.
'==============================
PRINT " Your search string is " + LEFT$(Search$, 40) + " ..."
IF MatchCase THEN
PRINT " Match Upper/Lower Case was checked."
END IF
IF WholeWord THEN
PRINT " Whole Words Only was checked."
END IF
PRINT " " + RTRIM$(MID$(DB(Level%, 5 + SearchType).Text, 5)) + " was selected."
ExitLoop = -1 'bail out
CASE Cancel$
'=====================================
'Remove the dialog box from the screen
'=====================================
Action% = 5
CALL DiaLogic(DB(), LB(), Action%, Focus%, Ky$)
ExitLoop = -1 'bail out
CASE ELSE
END SELECT
END IF
LOOP UNTIL ExitLoop
COLOR 7, 0
CALL HideCursor
CLS
END